[PHP] DOMDocument load on a page returning 400 Bad Request status
Posted
by PeteWilliams
on Stack Overflow
See other posts from Stack Overflow
or by PeteWilliams
Published on 2010-04-10T23:01:20Z
Indexed on
2010/04/10
23:03 UTC
Read the original article
Hit count: 362
Hiya,
I'm trying to use the Last.fm API for an application I'm creating, but am having some problems with validation.
If an API request gives an error it returns a code and message in the response XML like this:
<lfm status="failed">
<error code="6">No user with that name</error>
</lfm>
However, the request also returns an HTTP status of 400 (or in some cases 403) which DOMDocument considers an error and so then refuses to parse the XML.
Is there any way round this, so that I can retrieve the error code and message?
Thanks
Pete
© Stack Overflow or respective owner